<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title></title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="/static/common/layui/css/layui.css"  media="all">
  <link rel="stylesheet" href="/static/common/font-awesome/css/font-awesome.min.css" media="all" />
  <link rel="stylesheet" href="/static/admin/css/admin.css"  media="all">
  <style type="text/css">

    /* tooltip */
    #tooltip{
      position:absolute;
      border:1px solid #ccc;
      background:#333;
      padding:2px;
      display:none;
      color:#fff;
    }
  </style>
</head>
<body style="padding:10px;">
  <div class="tplay-body-div">
    <div class="layui-tab">
      <ul class="layui-tab-title">
        <li class="layui-this">云盟洗车</li>
        <li><a href="{:url('xiche/addEdit')}" class="a_menu">新增加盟</a></li>
      </ul>
    </div>
    <form class="layui-form serch" action="{:url('xiche/lst')}" method="post">
      <div class="layui-form-item" style="float: left;">
        <div class="layui-input-inline">
          <input type="text" name="name" lay-verify="title" autocomplete="off" placeholder="请输入关键词" class="layui-input layui-btn-sm">
        </div>
        <button class="layui-btn layui-btn-danger layui-btn-sm" lay-submit="" lay-filter="serch">立即提交</button>
      </div>
    </form>
    <table class="layui-table" lay-size="sm">
      <colgroup>
        <col width="50">
        <col width="150">
        <col width="300">
        <col width="150">
        <col width="100">
        <col width="100">
        <col width="100">
        <col width="150">
        <col width="100">
        <col width="100">
        <col width="100">
        <col width="100">
        <col width="150">
        <col width="150">
      </colgroup>
      <thead>
        <tr>
          <th>图片</th>
          <th>名称</th>
          <th>地址</th>
          <th>电话</th>
          <th>轿车价格</th>
          <th>SUV价格</th>
          <th>SPV价格</th>
          <th>坐标地址</th>
          <th>洗车次数</th>
          <th>核销码</th>
          <th>是否带保养</th>
          <th>状态</th>
          <th>加入时间</th>
          <th>操作</th>
        </tr> 
      </thead>
      <tbody>
        {volist name="xiche" id="vo"}
        <tr>
          <td>
            <a href="{$vo.pic|getUrl}" class="tooltip"><img src="{$vo.pic|getUrl}" width="20" height="20"></a>
          </td>
          <td>{$vo.name}</td>
          <td>{$vo.address}</td>
          <td>{$vo.tel}</td>
          <td><span style="color:red;">（{$vo.hycar/100}）</span>{$vo.car}</td>
          <td><span style="color:red;">（{$vo.hysuv/100}）</span>{$vo.suv}</td>
          <td><span style="color:red;">（{$vo.hyspv/100}）</span>{$vo.spv}</td>
          <td>{$vo.zuob}</td>
          <td>{$vo.cishu}次</td>
          <td>{$vo.hexiao}</td>
          <td>
            {if condition="$vo['type'] eq 1" /}
            <span class="layui-badge layui-bg-orange">是</span>
            {else /}
            <span class="layui-badge layui-bg-gray">否</span>
            {/if}
          </td>
          <td>
            {if condition="$vo['status'] eq 1" /}
            <span class="layui-badge layui-bg-orange">展示</span>
            {else /}
            <span class="layui-badge layui-bg-gray">下架</span>
            {/if}
          </td>
          <td>{$vo.create_time|date="Y-m-d"}</td>
          <td class="operation-menu">
            <div class="layui-btn-group">
              <a class="layui-btn layui-btn-xs open layui-btn-primary" data-id="{$vo.id}" style="margin-right: 0;font-size:12px;"><i class="fa {if condition="$vo.status eq 1"}fa-toggle-on{else/}fa-toggle-off{/if}"></i></a>
              <a href="{:url('xiche/addEdit',['id'=>$vo.id])}" class="layui-btn layui-btn-xs a_menu layui-btn-primary" style="margin-right: 0;font-size:12px;"><i class="layui-icon"></i></a>
              <a class="layui-btn layui-btn-xs layui-btn-primary delete" id="{$vo.id}" style="margin-right: 0;font-size:12px;"><i class="layui-icon"></i></a>
            </div>
          </td>
        </tr>
        {/volist}
      </tbody>
    </table>
    <div style="padding:0 20px;">{$xiche|raw}</div>
    <script src="/static/common/layui/layui.js" charset="utf-8"></script>
    <script src="/static/common/jquery/jquery.min.js"></script>
    <script>
      var message;
      layui.config({
          base: '/static/admin/js/',
          version: '1.0.1'
      }).use(['app', 'message'], function() {
          var app = layui.app,
              $ = layui.jquery,
              layer = layui.layer;
          //将message设置为全局以便子页面调用
          message = layui.message;
          //主入口
          app.set({
              type: 'iframe'
          }).init();
      });
    </script>
    <script type="text/javascript">
    $('.delete').click(function(){
      var id = $(this).attr('id');
      layer.confirm('确定要删除?', function(index) {
        $.ajax({
          url:"{:url('xiche/del')}",
          data:{id:id},
          success:function(res) {
            layer.msg(res.msg);
            if(res.code == 1) {
              setTimeout(function(){
                location.href = res.url;
              },1500)
            }
          }
        })
      })
    })
    </script>
    <script type="text/javascript">
      layui.use('layer', function(){
        var layer = layui.layer;
        $('.open').click(function(){
          var id = $(this).attr('data-id');
          layer.msg('文件审核',{
            time:20000
            ,btn: ['上架', '下架', '再想想']
            ,yes: function(index, layero){
              $.ajax({
                url:"{:url('xiche/audit')}"
                ,type:'post'
                ,data:{id:id,status:'1'}
                ,success:function(res){
                  layer.msg(res.msg);
                  if(res.code == 1){
                    setTimeout(function(){
                      location.href = res.url;
                    },1500)
                  }
                }
              })
            }
            ,btn2: function(index, layero){
              $.ajax({
                url:"{:url('xiche/audit')}"
                ,type:'post'
                ,data:{id:id,status:'-1'}
                ,success:function(res){
                  layer.msg(res.msg);
                  if(res.code == 1){
                    setTimeout(function(){
                      location.href = res.url;
                    },1500)
                  }
                }
              })
            }
          })
        })
      });              
    </script>
  </div>
</body>
</html>
